
Ext.define('IAG.view.user.List' ,{
    extend: 'Ext.window.Window',
    alias : 'widget.userlist',

    title : 'IATI Collector',
    layout: 'fit',
    autoShow: true,
    closable: false,
    draggable: false,
    toFrontOnShow: false,
    height: 550,
    width: 750,
    
    tbar: {
    		xtype: "toolbar",
    		layout: {
    			overflowHandler: 'Menu'
    		},
    		items: [{
	    			xtype:'button',
	    			id: 'usersMainToolbarButton',
	    			text: 'Show users',
	    			iconCls: 'usersMainToolbarButton',
	    			action: 'mainToolbarToggle',
	    			enableToggle: true,
	    			allowDepress: false,
	    			toggleGroup: "usersSettingsGroup",
	    			pressed: true
	    		},{
	    			xtype: 'button',
	    			id: 'settingsMainToolbarButton',
	    			text: 'Show settings',
	    			iconCls: 'settingsMainToolbarButton',
	    			action: 'mainToolbarToggle',
	    			enableToggle: true,
	    			allowDepress: false,
	    			toggleGroup: "usersSettingsGroup"
	    		}
	    		,{
	    			xtype: 'button',
	    			id: 'logsMainToolbarButton',
	    			text: 'Show logs',
	    			iconCls: 'logsMainToolbarButton',
	    			action: 'mainToolbarToggle',
	    			enableToggle: true,
	    			allowDepress: false,
	    			toggleGroup: "usersSettingsGroup"
	    		},"-", 
	    		"->",
	    		{
	    			xtype: 'button',
	    			iconCls: 'cacheStatisticsButton',
	    			text: 'Create statistics',
	    			action: 'cacheStatistics',
	    			enableToggle: true,
	    			allowDepress: false,
	    			pressed: false
	    		},
	    		{
	    			xtype: 'button',
	    			iconCls: 'reloadAllMainToolbarButton',
	    			text: 'Reinitialize db',
	    			action: 'reloadAllFeeds',
	    			enableToggle: true,
	    			allowDepress: false,
	    			pressed: true
	    		},"-",
	    		{
	    			xtype: 'button',
	    			iconCls: 'logoutMainToolbarButton',
	    			text: 'Logout',
	    			action: 'logout'
	    		}
    		]
    	

    },
    items: [
            {
                xtype: 'gridpanel',
                alias: 'widget.usersGridPanel',
                itemId: 'usersGridPanel',
                store: 'UsersStore',

                columns: [
                    {header: 'Username',  dataIndex: 'username',  flex: 1},
                    {header: 'First Name',  dataIndex: 'firstname',  flex: 1},
                    {header: 'Last Name',  dataIndex: 'lastname',  flex: 1},
                    {header: 'Password', dataIndex: 'md5Password', flex: 1}
                ],
            	buttons:[
            	            {
            	                text: 'Add User',
            	                action: 'showAddUser',
            	                iconCls: 'addButton'
            	            },
            	            {
            	                text: 'Reload',
            	                action: 'reload'
            	            }
            	           ]
            }
        ]
    
    
});

